<extend name="Common@Layout:base" />
<block name="title">
    <title>{:L('forget')}</title>
</block>
<block name="style">
</block>

<block name="main">
    <include file="Common@Include:header" />

    <div class="main layui-clear">
        <div class="fly-panel fly-panel-user" pad20>
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">{:L('forget')}</li>
                </ul>
                <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-form layui-form-pane">
                            <form method="post" action="{:U('check_code_post')}">
                                <div class="layui-form-item">
                                    <label for="L_email" class="layui-form-label">{:L('email')}</label>
                                    <div class="layui-input-inline">
                                        <input type="text" id="L_email" name="email" required lay-verify="email" autocomplete="off" class="layui-input"></div>
                                    <div class="layui-form-mid layui-word-aux"></div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_email" class="layui-form-label">验证码</label>
                                    <div class="layui-input-inline">
                                        <input type="text" id="" name="code" required="" autocomplete="off" class="layui-input"></div>
                                    <div class="layui-word-aux">
                                        <a href="javascript:;" class="send-email layui-btn" data-msg="">
											发送验证码
                                        </a>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_pass" class="layui-form-label">新密码</label>
                                    <div class="layui-input-inline">
                                        <input type="password" id="L_pass" name="pass" required lay-verify="required" autocomplete="off" class="layui-input"></div>
                                    <div class="layui-form-mid layui-word-aux">{:L('tip_reg_pwd')}</div>
                                </div>
                                <div class="layui-form-item">
                                    <label for="L_repass" class="layui-form-label">{:L('rePassword')}</label>
                                    <div class="layui-input-inline">
                                        <input type="password" id="L_repass" name="repass" required lay-verify="required" autocomplete="off" class="layui-input"></div>
                                </div>

                                <div class="layui-form-item">
                                    <button class="layui-btn" lay-filter="*" lay-submit>提交</button>
                                </div>

                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <include file="Common@Include:footer" />
</block>

<block name="script">
    <js href="/Public/jquery.min.js" />
    <script>
        var first = 1;
        $('.send-email').click(function() {
            var email = $('#L_email').val();
            if (first == 1) {
                $.get('/User/Forget/send_email.html', {
                    "email": email
                }, function(ret) {
                    if (ret.status) {
                        layer.msg(ret.info, {
                            icon: 1,
                            time: 1000
                        });
                    } else {
                        layer.msg(ret.info, {
                            icon: 2,
                            time: 1000
                        });
                    }
                });


                $('.send-email').html('未收到邮件？重新发送');
                first = 0;
            } else {
                layer.confirm('是否确定重新发送？', function() {
                    layer.closeAll();
                    $.get('/User/Forget/send_email.html', {
                        "email": email
                    }, function(ret) {
                        if (ret.status) {
                            layer.msg(ret.info, {
                                icon: 1,
                                time: 1000
                            });
                        } else {
                            layer.msg(ret.info, {
                                icon: 2,
                                time: 1000
                            });
                        }
                    });
                });
            }
        });
    </script>
</block>